package com.diao.flink.streamapi.source

import org.apache.flink.api.scala._
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment
/**
 * @author: Chenzhidiao
 * @date: 2020/3/26 7:47
 * @description:
 * @version: 1.0
 */

case class SensorReading(
                        id:String,
                        timestamp:Long,
                        temperature:Double
                        )
object SourceTest {
  def main(args: Array[String]): Unit = {
    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment
    val Stream1 = env.fromCollection( List(
      SensorReading("sensor_1", 1547718199, 35.80018327300259),
      SensorReading("sensor_6", 1547718201, 15.402984393403084),
      SensorReading("sensor_7", 1547718202, 6.720945201171228),
      SensorReading("sensor_10", 1547718205, 38.101067604893444))
    )

    Stream1.print("stream1:").setParallelism(1)

    env.execute()
  }

}
